package com.tudouji.project.system.service.impl;

import java.util.List;

import com.tudouji.common.utils.DateUtils;
import com.tudouji.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tudouji.project.system.mapper.CusDepartGroupMapper;
import com.tudouji.project.system.domain.CusDepartGroup;
import com.tudouji.project.system.service.ICusDepartGroupService;

/**
 * 部门客户关联Service业务层处理
 *
 * @author tudouji
 * @date 2021-02-01
 */
@Service
public class CusDepartGroupServiceImpl implements ICusDepartGroupService
{
    @Autowired
    private CusDepartGroupMapper cusdepartgroupMapper;

    /**
     * 查询部门客户关联
     *
     * @param guid 部门客户关联ID
     * @return 部门客户关联
     */
    @Override
    public CusDepartGroup selectCusDepartGroupById(String guid)
    {
        return cusdepartgroupMapper.selectCusDepartGroupById(guid);
    }

    /**
     * 查询部门客户关联列表
     *
     * @param cusdepartgroup 部门客户关联
     * @return 部门客户关联
     */
    @Override
    public List<CusDepartGroup> selectCusDepartGroupList(CusDepartGroup cusdepartgroup)
    {
        return cusdepartgroupMapper.selectCusDepartGroupList(cusdepartgroup);
    }

    /**
     * 新增部门客户关联
     *
     * @param cusdepartgroup 部门客户关联
     * @return 结果
     */
    @Override
    public int insertCusDepartGroup(CusDepartGroup cusdepartgroup)
    {
        cusdepartgroup.setCreatetime(DateUtils.getNowDate());
        cusdepartgroup.setLastupdate(DateUtils.getNowDate());
        cusdepartgroup.setOperatorid(SecurityUtils.getLoginUser().getUser().getUserId().toString());
        cusdepartgroup.setOperator(SecurityUtils.getLoginUser().getUser().getNickName());
        return cusdepartgroupMapper.insertCusDepartGroup(cusdepartgroup);
    }

    /**
     * 修改部门客户关联
     *
     * @param cusdepartgroup 部门客户关联
     * @return 结果
     */
    @Override
    public int updateCusDepartGroup(CusDepartGroup cusdepartgroup)
    {
        cusdepartgroup.setLastupdate(DateUtils.getNowDate());
        return cusdepartgroupMapper.updateCusDepartGroup(cusdepartgroup);
    }

    /**
     * 批量删除部门客户关联
     *
     * @param guids 需要删除的部门客户关联ID
     * @return 结果
     */
    @Override
    public int deleteCusDepartGroupByIds(String[] guids)
    {
        return cusdepartgroupMapper.deleteCusDepartGroupByIds(guids);
    }

    /**
     * 删除部门客户关联信息
     *
     * @param guid 部门客户关联ID
     * @return 结果
     */
    @Override
    public int deleteCusDepartGroupById(String guid)
    {
        return cusdepartgroupMapper.deleteCusDepartGroupById(guid);
    }
}
